<?php
	include_once("king_head.php");
?>

<?php
	include_once("ClsSebent/config.php");
	
	if("$action"=="resetlogo" && $_SESSION['SITE_ID']!="")
	{
	$ql="select * from site_home where id=101";
	$rl=mysql_query($ql);
	$res=mysql_fetch_array($rl);	
	$loq="UPDATE site_home SET logo_alt='".mysql_escape_string($res['logo_alt'])."'";
	mysql_query($loq);
	
	if(!copy("./logos/101_frontlogo.jpg","./logos/${site_id}_frontlogo.jpg" /***. $logo_name***/)){ echo "coping error!"; exit;}	
	
	}

	if("$action"=="Save" && $_SESSION['SITE_ID'] != ""){

		$sql="UPDATE site_home SET logo_alt='".mysql_escape_string($logo_alt)."'";
	    if (isset($logo) && $logo != "") {

			if(!copy($logo,"./logos/${site_id}_frontlogo.jpg" /***. $logo_name***/)){ echo "coping error!"; exit;}
			$sql=$sql . ", logo='$logo_name'";
		}
		$sql=$sql . " WHERE id=$_SESSION['SITE_ID']";
		//echo $sql;
		mysql_query($sql);

	}
	if("$rem_img"=="y" && $_SESSION['SITE_ID'] != ""){

		$sql="UPDATE site_home SET  logo='' WHERE id=$_SESSION['SITE_ID']";
		//echo $sql;
		mysql_query($sql);

	}

	$sql="SELECT id,logo,logo_alt FROM site_home WHERE id=$_SESSION['SITE_ID']";

	$result = mysql_query($sql);
	if($row=mysql_fetch_array($result)){
		$logo=stripslashes($row["logo"]);
		$logo_alt=stripslashes($row["logo_alt"]);
	}
?>
<script type="text/javascript">
function confirmation()
{
var c=confirm("The Changes will not be reverted back. Although, you can set them again manually. Are you sure to Save Changes??");
if(c)
return true;
else
return false;
}
</script>
<CENTER>
<H2> <!--Website's default Meta-tags-->
  <span style="font-family: Verdana; font-size: 12px">Click <span style="color: #0000FF">Refresh Logo</span> if the changes do not reflect.</span> </H2>
<form enctype="multipart/form-data"  method="post" onsubmit="javascript: return confirmation();">
<?php if($_SESSION['SITE_ID']!=101){?><a href="confirm.php?action=resetlogo&site_id=<?php echo $_SESSION['SITE_ID']; ?>">Reset the website logo</a><?php }?>
<input type=hidden name=site_id value="<?php echo $_SESSION['SITE_ID']; ?>">
<TABLE align="center">
<TR><td width="95" valign="top">Company logo</td><td width="385">
  <input  type=file name=logo value="<?php ?>" size=20>
  &nbsp;
  <?php if("$logo" !=""){ ?>
  <BR>    <a href="logoclips.php?sid=<?php print($_SESSION['SITE_ID']);?>" target="_n1">View/Change current logo</a>&nbsp;&nbsp;<a href='logo.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>&rem_img=y'>Remove Logo</a>
    <?php } else echo "(No existing logo)"; ?>
    <BR>    <a href="logoclips.php?sid=<?php echo $_SESSION['SITE_ID'];?>" target="_blank">Select a new Logo</a>&nbsp;&nbsp;<a href="logo.php?site_id=<?php echo $_SESSION['SITE_ID'];?>">Refresh Logo</a></td></tr>
<tr><td>Logo alt </td><td>    <input name=logo_alt value="<?php echo $logo_alt; ?>" size=40>  </td></tr>
<tr><td colspan=2 align=center>    <input type=submit name=action value=Save>  </TD>
</TR>
</TABLE>
</form>
</CENTER>

<?php
	include_once("king_foot.php");
?>